﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;

public partial class Manage_HelpAdd : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string strName, strContent;


        System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> _AccountType = new System.Collections.Generic.List<HZ.MBSM.DAL.AccountType>();
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumAdmin);
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumAttorney);
        if (HZ.MBSM.BLL.Login.CheckAssert(_AccountType))
        {
            if (Request.Form["btnSubmit"] == "保  存")
            {
                strName = Request.Form["txtName"];
                strContent = Request.Form["txtContentHtml"];
                if (strName.Trim().Length == 0)
                {
                    Response.Write("<script>alert('标题不能为空！！！');</script>");
                    return;
                }
                if (strContent.Trim().Length == 0)
                {
                    Response.Write("<script>alert('内容不能为空！！！');</script>");
                    return;
                }

                Db db = new Db();
                Grove.ORM.ObjectOperator oo = db.GetObjectOperator();
                HZ.MBSM.Model.HelpTable HelpTable = new HZ.MBSM.Model.HelpTable();
                HelpTable.Title = strName;
                HelpTable.Content = strContent.Replace("\r\n", "");
                HelpTable.AddDate = System.DateTime.Now;
                oo.Insert(HelpTable);
                oo.Dispose();
                db.Close();
                Response.Write("<script>alert('保存成功！！！');</script>");
                HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)Session["Account"];
                HZ.MBSM.BLL.LogManage.RecordLoginDetail(_Account.AccountName, Request.UserHostAddress, "插入", "HelpTable", HelpTable.Title + "|" + HelpTable.Content + "|" + HelpTable.AddDate, "../Magage/HelpAdd.aspx");

                Response.Write("<script>window.opener.location.reload();window.close();</script>");

            }
        }
    }
}
